package com.jiyun.controller;

import com.jiyun.information.*;
import com.jiyun.jumin.JuminClient;
//import com.jiyun.management.ManagementClient;
import com.jiyun.management.ManagementClient;
import com.jiyun.model.information.ZlDoctor;
import com.jiyun.model.information.ZlItempm;
import com.jiyun.model.information.ZlTeam;

import com.jiyun.model.jumin.Jumin;
import com.jiyun.model.management.Loca;
import com.jiyun.model.xitong.Biaoqian;
import com.jiyun.result.Result;
import com.jiyun.xitong.BiaoqianClient;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("zong")
@CrossOrigin
public class ZongController {

    @Autowired
    ZlTeamClient zlTeamClient;
    @Autowired
    ZlServiceClient zlServiceClient;
    @Autowired
    BiaoqianClient biaoqianClient;
    @Autowired
    ZlItempmClient zlItempmClient;
    @Autowired
    ZlInstitutionClient zlInstitutionClient;
    @Autowired
    ZlDoctorClient zlDoctorClient;
    @Autowired
    JuminClient juminClient;
    @Autowired
    ManagementClient managementClient;

    @ApiOperation("远程调用其他表")
    @RequestMapping("findAll")
    public Map<String, Object> findAll(){
//      医生团队服务
        Result doctor = zlTeamClient.findDoctor();
        List<ZlTeam> TeamList = (List<ZlTeam>) doctor.getData();
//        服务包内容
        Result service = zlServiceClient.findService();
        List<ZlTeam> ServiceList = (List<ZlTeam>) service.getData();
//        查询标签的所有
        List<Biaoqian> BqList = biaoqianClient.findBiaoQian();
//        查询服务项目的所有
        Result itempm = zlItempmClient.findDoctor();
        List<ZlItempm> ItempmList = (List<ZlItempm>) itempm.getData();
//        查询机构的所有
        Result name = zlInstitutionClient.findName();
        List<String> InstitutionList = (List<String>) name.getData();
//        查询医生列表
        Result doctor1 = zlDoctorClient.findDoctor();
        List<ZlDoctor> DoctorList = (List<ZlDoctor>) doctor1.getData();

        List<Jumin> JuminList = juminClient.findAll();

        List<Loca> LocaList = managementClient.findAll();


//       总和到map里面
        Map<String, Object> map = new HashMap<>();


        map.put("TeamList",TeamList);
        map.put("ServiceList",ServiceList);
        map.put("BqList",BqList);
        map.put("ItempmList",ItempmList);
        map.put("InstitutionList",InstitutionList);
        map.put("DoctorList",DoctorList);
        map.put("JuminList",JuminList);
        map.put("LocaList",LocaList);

        return map;
    }

}
